home *** CD-ROM | disk | FTP | other *** search
- package sun.net.www.http;
-
- import java.net.URL;
- import java.util.Hashtable;
-
- public class AuthenticationInfo {
- String host;
- int port;
- String realm;
- String auth;
- static Hashtable cache = new Hashtable();
- static Hashtable preemptiveCache = new Hashtable();
-
- public static void cacheInfo(AuthenticationInfo var0) {
- cache.put(var0, var0);
- }
-
- public static void uncacheInfo(AuthenticationInfo var0) {
- cache.remove(var0);
- }
-
- public static void cacheInfo(AuthenticationInfo var0, URL var1) {
- cache.put(var0, var0);
- preemptiveCache.put(var1, var0);
- }
-
- public static void uncacheInfo(AuthenticationInfo var0, URL var1) {
- cache.remove(var0);
- preemptiveCache.remove(var1);
- }
-
- public static AuthenticationInfo getAuth(URL var0) {
- AuthenticationInfo var1 = (AuthenticationInfo)preemptiveCache.get(var0);
- return var1;
- }
-
- public static AuthenticationInfo getAuth(URL var0, String var1) {
- AuthenticationInfo var2 = (AuthenticationInfo)cache.get(new AuthenticationInfo(var0.getHost(), var0.getPort(), var1));
- return var2;
- }
-
- public AuthenticationInfo(URL var1, String var2, String var3) {
- this(var1, var3);
- this.realm = var2;
- }
-
- public AuthenticationInfo(URL var1, String var2) {
- this.realm = "";
- this.host = var1.getHost();
- this.port = var1.getPort();
- this.auth = var2;
- cache.put(this, this);
- preemptiveCache.put(var1, this);
- }
-
- public AuthenticationInfo(String var1, int var2, String var3) {
- this.host = var1;
- this.port = var2;
- this.realm = var3;
- }
-
- public AuthenticationInfo(String var1, int var2, String var3, String var4) {
- this(var1, var2, var3);
- this.auth = var4;
- cache.put(this, this);
- }
-
- public int hashCode() {
- return this.host.hashCode() ^ this.port ^ this.realm.hashCode();
- }
-
- public boolean equals(Object var1) {
- if (var1 instanceof AuthenticationInfo) {
- AuthenticationInfo var2 = (AuthenticationInfo)var1;
- return var2.host.equals(this.host) && var2.port == this.port && var2.realm.equals(this.realm);
- } else {
- return false;
- }
- }
-
- public String toString() {
- return "AuthenticationInfo[" + this.realm + "@" + this.host + ":" + this.port + "] -> " + this.auth;
- }
- }
-